<template>
  <div>
    <!-- 表格区域 -->
    <el-table :data="Olist"
              style="width: 100%">
      <!--            <el-table-column prop="index" label="序号" ></el-table-column>-->
      <el-table-column prop="orderId" label="订单编号"></el-table-column>
      <el-table-column prop="patientName" label="患者姓名" ></el-table-column>
      <el-table-column prop="medicationName" label="开药名称"></el-table-column>
    </el-table>

    <!-- 分页区域 -->
    <el-pagination
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pageNum"
      :page-sizes="[5,10,15]"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
  </div>
</template>

<script>
import { getAllOrderList } from '@/api/drugorder/order'

export default {
  name: "OrderDetails",
  data() {
    return {
      Olist: [],
      detailsForm:{
        orderId: '',
        patientName: '',
        medicationName: '',
      },
      pageNum: 1,
      pageSize: 10,
      total: 0,
    }
  },
  methods: {
    getAll() {
      getAllOrderList({
        pageNum: this.pageNum,
        pageSize: this.pageSize,
      }).then(res => {
        this.Olist = res.data.list;
        this.total = res.data.total;
      });
    },

    handleSizeChange(size) {
      this.pageSize = size;
      this.getAll();
    },
    handleCurrentChange(currentPage) {
      this.pageNum = currentPage;
      this.getAll();
    },
  },
  created() {
    this.getAll()
  }
}
</script>

<style scoped>
/* 样式调整 */
.demo-form-inline {
  margin-bottom: 20px;
}
</style>
